/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.its.dsw2.view;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author Eli
 */
@ManagedBean
@SessionScoped
public class LoginBean {

    //--------------------EJB's calls-----------------------
    //--------------------Variables-------------------------
    private String user;
    private String password;

    public LoginBean() {
    }

    //------------------Getters & Setters-------------------
    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    //------------------Actions-----------------------------The strokes

    public String actionProcess() {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap().put("USUARIO_LOGUEADO", user);
        if (user.equals("eli") && password.equals("666")) {
            return "PrincipalMenu";
        } else {
            return "Login";
        }
    }
    //------------------Listeners---------------------------
}
